# -*- coding: UTF-8 -*-

from tkinter import *
from math import *
import random
from Ressources import *
from Planete import *
from etoile import *
from Unite import *
from VaisseauV1 import *

class Vue2():
    def __init__(self,parent):
        self.controleur = parent
        

        self.root = Tk()
        self.imageSoleil = PhotoImage(file = 'soleil.gif',master=self.root)
        self.imagePlanete = PhotoImage(file = 'planete.gif',master=self.root)
        self.imageUnivers = PhotoImage(file = 'univers.gif',master=self.root)
        self.vaisseau1 = PhotoImage(file = 'vaisseau1.gif',master=self.root)
        self.vaisseau2 = PhotoImage(file = 'vaisseau2.gif',master=self.root)
        self.imageRobot = PhotoImage(file = 'robot1.gif',master=self.root)
        self.imageUsine = PhotoImage(file = 'usine.gif',master=self.root)
        self.imageMine = PhotoImage(file = 'mine.gif',master=self.root)
        self.imageSable = PhotoImage(file = 'sable.gif',master=self.root)
        self.imageMinerais = PhotoImage(file = 'minerais.gif',master=self.root)
        self.motherShip1 = PhotoImage(file = 'motherShip1.gif',master=self.root)
        self.motherShip2 = PhotoImage(file = 'motherShip2.gif',master=self.root)

        
        self.root.title = "Les razmokets"
        self.canvasXMin = 0
        self.canvasYMin = 0
        self.canvasPlaneteX=0
        self.canvasPlaneteY=0

        self.canvasXMax = 3200
        self.canvasYMax = 1800
        self.hauteur = 600
        self.largeur = 800
        self.isVueUnivers = True
        self.modeConst = False
        self.nomBati = ""

        
        #############################
        ###### Frame et Canvas ######
        #############################
        
        ################# Frame du jeux ###################
        self.canvas=Canvas(self.root,width=800,height=600,background="black",xscrollincrement=1,yscrollincrement=1)
        self.canvas.create_image(1600,900,image =self.imageUnivers, tags=("image"))
        self.canvas.grid(row=1,rowspan=3,column=1)
        
        ################ Frame INFO ################################## 
        # Frame info lorsqu'on clique sur un objet
        self.information=Frame(self.root)
        
        #Elements du frame infos
        self.Titre = Label(self.information, text="Informations", font=("Calibri", 16))
        
        self.labelT = Label(self.information, text="       TYPE: ", width=15)
        self.labelN = Label(self.information, text="        NOM: ", width=15)
        self.label1 = Label(self.information, text="Coordonee X: ", width=15)
        self.label2 = Label(self.information, text="Coordonee Y: ", width=15)
        self.label3 = Label(self.information, text="Coordonee Z: ", width=15)
        self.label4 = Label(self.information, text=" ", width=15)
        self.label5 = Label(self.information, text=" ",width=15)
        
        self.labelType = Label(self.information, text=" cliquer", width=15)
        self.labelNom = Label(self.information, text="pour", width=15)
        self.labelX = Label(self.information, text="faire", width=15)
        self.labelY = Label(self.information, text="apparaitre", width=15)
        self.labelZ = Label(self.information, text="les", width=15)
        self.labelSys = Label(self.information, text="informations", width=15)
        self.labelPro = Label(self.information, text="ici", width=15)
        
        self.Titre.grid(row=1,column=1,columnspan=2)
        
        self.labelT.grid(row=2,column=1)
        self.labelN.grid(row=3,column=1)
        self.label1.grid(row=4,column=1)
        self.label2.grid(row=5,column=1)
        self.label3.grid(row=6,column=1)
        self.label4.grid(row=7,column=1)
        self.label5.grid(row=8,column=1)
        
        self.labelType.grid(row=2,column=2)
        self.labelNom.grid(row=3,column=2)
        self.labelX.grid(row=4,column=2)
        self.labelY.grid(row=5,column=2)
        self.labelZ.grid(row=6,column=2)
        self.labelSys.grid(row=7,column=2)
        self.labelPro.grid(row=8,column=2)
        
        self.information.grid(row=1,column=3)
        
        ######## Les boutons du menu ########################
        
        self.frameBoutton = Frame(self.root)
        
         #---------------------frame bouton----------------------#   
        self.bouton1 = Button(self.frameBoutton, text="", width=5)
        self.bouton2 = Button(self.frameBoutton, text="", width=5)
        self.bouton3 = Button(self.frameBoutton, text="", width=5)
        self.bouton4 = Button(self.frameBoutton, text="", width=5)
        
        self.bouton5 = Button(self.frameBoutton, text="", width=5)
        self.bouton6 = Button(self.frameBoutton, text="", width=5)
        self.bouton7 = Button(self.frameBoutton, text="", width=5)
        self.bouton8 = Button(self.frameBoutton, text="", width=5)
        
        self.bouton9 = Button(self.frameBoutton, text="", width=5)
        self.bouton10 = Button(self.frameBoutton, text="", width=5)
        self.bouton11 = Button(self.frameBoutton, text="", width=5)
        self.bouton12 = Button(self.frameBoutton, text="", width=5)
        
        self.bouton13 = Button(self.frameBoutton, text="", width=5)
        self.bouton14 = Button(self.frameBoutton, text="", width=5)
        self.bouton15 = Button(self.frameBoutton, text="", width=5)
        self.bouton16 = Button(self.frameBoutton, text="", width=5)
        
        self.bouton1.grid(row=1,column=1)
        self.bouton2.grid(row=2,column=1)
        self.bouton3.grid(row=3,column=1)
        self.bouton4.grid(row=4,column=1)
        
        self.bouton5.grid(row=1,column=2)
        self.bouton6.grid(row=2,column=2)
        self.bouton7.grid(row=3,column=2)
        self.bouton8.grid(row=4,column=2)
        
        self.bouton9.grid(row=1,column=3)
        self.bouton10.grid(row=2,column=3)
        self.bouton11.grid(row=3,column=3)
        self.bouton12.grid(row=4,column=3)
        
        self.bouton13.grid(row=1,column=4)
        self.bouton14.grid(row=2,column=4)
        self.bouton15.grid(row=3,column=4)
        self.bouton16.grid(row=4,column=4)
        
        self.frameBoutton.grid(row=2,column=3)
        
        ############ Grid MINIMAP ###################
         
        self.miniMap=Canvas(self.root,width=200,height=150,background="black")
        self.miniMap.grid(row=3,column=3)
        
        ############ Info Joueur ####################
        
        self.frameJoueur=Frame(self.root)
        self.frameJoueur.grid(row=4, column=3)
        
        self.labelMine = Label(self.frameJoueur, text="Minerais : ", width=15)
        self.labelMine.grid(row=1, column=1)
        
                     
        #############################
        ########## Binding ##########
        #############################
        
        self.root.bind('<Up>', self.flecheHaut)
        self.root.bind("<Down>", self.flecheBas)
        self.root.bind("<Left>", self.flecheGauche)
        self.root.bind("<Right>", self.flecheDroite)
        
        self.canvas.bind("<Button-2>",self.clicDroit)
        self.canvas.bind("<Button-1>",self.clicGauche)
        self.canvas.bind("<B1-Motion>", self.getFinSelection)
        self.canvas.bind("<ButtonRelease-1>", self.detruireSelection)
        
        self.selection=[]

        
    '''Methodes pour selection/Drag '''  
    def getFinSelection(self,ev):            
        if self.clicGauche:
            if (self.debutSelection[0]-ev.x)!=0:
                selection=self.canvas.find_enclosed(self.debutSelection[0], self.debutSelection[1], ev.x, ev.y)
                self.canvas.delete("selectione")
                self.canvas.create_rectangle(self.debutSelection[0], self.debutSelection[1], ev.x, ev.y, outline="red", tags="selectione", dash=(2,6))
                
                for i in selection:
                   
                    s=self.canvas.gettags(i)#contient nom et id 
                    if(s[0]=="Vaisseau"):
                       
                        self.afficherInfoVaisseau(int(s[1]))
                    
                    elif(s[0]=="Unite"):
                        self.afficherInfoUnite(int(s[1]))
            else:         
                self.canvas.delete("selectione")

    def detruireSelection(self,ev):                        
        self.canvas.delete("selectione")
        del self.selection[:]
        
        ''' fin methodes pour selection/Drag '''  

    
    def afficherEtoile(self,etoile):
        if(etoile.isAffiche):
            px0=(etoile.x)-40
            px1=(etoile.x)+40
            py0=(etoile.y)-40
            py1=(etoile.y)+40
            
            
            self.canvas.create_image(etoile.x, etoile.y, image =self.imageSoleil, tags=(str([etoile.x,etoile.y])))
            self.miniMap.create_oval(etoile.x/16-2,etoile.y/12-2,etoile.x/16+2,etoile.y/12+2,fill="yellow",tags=(str([etoile.x,etoile.y])))
                
            
        
    def afficherPlanete(self,planete):
        if(planete.isAffiche):
            px0=(planete.posX)-19
            px1=(planete.posX)+19
            py0=(planete.posY)-19
            py1=(planete.posY)+19
            self.canvas.create_image(planete.posX, planete.posY, image =self.imagePlanete, tags=("Planete", planete.ID, planete.sysSolaire,str([planete.posX,planete.posY])))

            self.miniMap.create_oval(planete.posX/16-1,planete.posY/12-1,planete.posX/16+1,planete.posY/12+1,fill="cyan",tags=(str([planete.posX,planete.posY])))

        
    
    def move_to(self,x,y):
        scrollX= 0 -self.canvasXMin
        scrollY= 0 -self.canvasYMin
        if x>self.largeur/2:
            scrollX = int((x - self.canvasXMin) - (self.largeur/2))
        if y > self.hauteur/2:
            scrollY = int((y - self.canvasYMin) - (self.hauteur/2))
        self.canvasXMin += scrollX
        self.canvasYMin += scrollY    
        
        self.canvas.xview_scroll(scrollX, "unit" )
        self.canvas.yview_scroll(scrollY, "unit" )
        
              
    
    def afficherUnivers(self):
        self.canvas.config(bg="black")
        self.move_to(0, 0)
        self.canvas.delete(ALL)
        self.miniMap.delete(ALL)
        self.canvas.create_image(1600,900,image = self.imageUnivers, tags=("image"))
        self.move_to(self.controleur.getPlaneteCourante().posX, self.controleur.getPlaneteCourante().posY)
        self.setInfo()
        self.controleur.afficherUnivers()
        self.canvasXMax=3200
        self.canvasYMax=1800
        self.isVueUnivers = True


    # Vues Planetes        
    def afficherVuePlanete(self):
        self.canvas.delete(ALL)
        self.miniMap.delete(ALL)
        self.canvasTempXMin = self.canvasXMin
        self.canvasTempYMin = self.canvasYMin
        self.setInfo()
        self.controleur.afficherVuePlanete()
        self.canvas.config(bg="#cc9900")
        self.isVueUnivers = False
        self.move_to(0, 0)
        
        self.bouton1.config(text="Deco", command=self.changeVue, state=NORMAL)
        self.bouton2.config(text="",state=DISABLED)
        self.bouton3.config(text="",state=DISABLED)
        
        for k in self.controleur.getPlaneteCourante().listeRessources:
            for l in k.listeBlocs:
                     posX0= (l.x)
                     posX1= (l.x)
                     posY0= (l.y)
                     posY1= (l.y)
                
                     self.canvas.create_image(l.x,l.y,image =self.imageMinerais,tags=("BlocRessource",k.type,l.id))
            self.canvasXMax=k.largeur
            self.canvasYMax=k.hauteur
    


    def afficherVaisseauSelectionne(self): # Cerlce vert
        self.canvas.delete("cercleSelection")
        for v in self.controleur.getListeVaisseauxCourants():
            if(v.iDjoueur == self.controleur.getIdMonJoueur()):
                self.canvas.create_oval((v.posx)-v.sizex/2,(v.posy)-v.sizey/2,(v.posx)+v.sizex/2,(v.posy)+v.sizey/2,outline="green",tags=("cercleSelection"))
    
    def afficherUniteSelectionne(self): # Cerlce vert
         self.canvas.delete("cercleSelection")
         for u in self.controleur.getListeUnitesCourants():
            if(u.iDjoueur == self.controleur.getIdMonJoueur()):
                 self.canvas.create_oval((u.posx)-u.sizex/2,(u.posy)-u.sizey/2,(u.posx)+u.sizex/2,(u.posy)+u.sizey/2,outline="green",tags=("cercleSelection"))
    
    
    def afficherVaisseau(self,v):
        self.supprimerObjet(v,"Vaisseau")
        
        vstr="j"+str(v.iDjoueur)+"v"+str(v.id)
        
        posx= v.posx
        posy = v.posy
        if(v.nom == "mothership" ):
            if(self.controleur.isAuJoueur(v.iDjoueur)):
                self.canvas.create_image(v.posx, v.posy, image =self.motherShip1, tags=("Vaisseau",v.id,v.iDjoueur,vstr))
                self.miniMap.create_oval(posx/16,posy/12,posx/16,posy/12,fill="red",tags=("MotherShip",v.id,v.iDjoueur,vstr))
            else:
                self.canvas.create_image(v.posx, v.posy, image =self.motherShip2, tags=("Vaisseau",v.id,v.iDjoueur,vstr))
                self.miniMap.create_oval(posx/16,posy/12,posx/16,posy/12,fill="pink",tags=("MotherShip",v.id,v.iDjoueur,vstr))
        else:
            if(self.controleur.isAuJoueur(v.iDjoueur)):
                self.canvas.create_image(v.posx, v.posy, image =self.vaisseau1, tags=("Vaisseau",v.id,v.iDjoueur,vstr))
                self.miniMap.create_oval(posx/16,posy/12,posx/16,posy/12,fill="red",tags=("Vaisseau",v.id,v.iDjoueur,vstr))
            else:
                self.canvas.create_image(v.posx, v.posy, image =self.vaisseau2, tags=("Vaisseau",v.id,v.iDjoueur,vstr))
                self.miniMap.create_oval(posx/16,posy/12,posx/16,posy/12,fill="pink",tags=("Vaisseau",v.id,v.iDjoueur,vstr))
        
        self.afficherVaisseauSelectionne()
             
    def afficherUnite(self,u):
        self.supprimerObjet(u,"Unite")
        ustr="j"+str(u.iDjoueur)+"u"+str(u.id)
        
        posx= u.posx
        posy = u.posy
        
        if(self.controleur.isAuJoueur(u.iDjoueur)): 
            self.canvas.create_image(u.posx, u.posy, image =self.imageRobot, tags=("Unite",u.id,u.iDjoueur,ustr))
            self.miniMap.create_oval(posx/16,posy/12,posx/16,posy/12,fill="green",tags=("Unite",u.id,u.iDjoueur,ustr))
        else:
             self.canvas.create_image(u.posx, u.posy, image =self.imageRobot, tags=("Unite",u.id,u.iDjoueur,ustr))
             self.miniMap.create_oval(posx/16,posy/12,posx/16,posy/12,fill="green",tags=("Unite",u.id,u.iDjoueur,ustr))
             
             
    def afficherVuePlaneteDef(self):
        self.label5.config(text="")
        
        self.labelType.config(text="Inconnu")
        self.labelNom.config(text="Sans nom")
        self.labelX.config(text=" ")
        self.labelY.config(text=" ")
        self.labelZ.config(text=" ")
        self.labelSys.config(text=" ")
        self.labelPro.config(text=" ")
        
        self.setBoutonDef()
        self.bouton1.config(text="Deco", command=self.changeVue, state=NORMAL)

    def afficherVuePlaneteBloc(self, type, id):
        
        for k in self.controleur.getPlaneteCourante().listeRessources:
            if (k.type == type):
                for l in k.listeBlocs:
                    if (l.id == id):
                        b = l
                        
        self.label5.config(text="Proprietaire: ")
        
        self.labelType.config(text=type)
        self.labelNom.config(text="Sans nom")
        self.labelX.config(text= str(b.x))
        self.labelY.config(text= str(b.y))
        self.labelZ.config(text= str(b.qte))
        self.labelSys.config(text="")
        self.labelPro.config(text=self.controleur.getPlaneteCourante().joueur)
        
        self.setBoutonDef()
        self.bouton1.config(text="Deco", command=self.changeVue, state=NORMAL)
     
        
    def ligneAttaque(self,vaisseauActif,vaisseauEnnemi):
         self.canvas.delete("atk")
         self.canvas.create_line((vaisseauActif.posx)-10,(vaisseauActif.posy),(vaisseauEnnemi.posx)-10,(vaisseauEnnemi.posy),fill="green",tags="atk")

    def supprimerObjet(self,o,type):
        if(type == "Vaisseau"):
            vstr="j"+str(o.iDjoueur)+"v"+str(o.id)
            self.canvas.delete(vstr)
            self.miniMap.delete(vstr)
        elif(type == "Unite"):
            ustr="j"+str(o.iDjoueur)+"u"+str(o.id)
            self.canvas.delete(ustr)
            self.miniMap.delete(ustr)
            
        if(o.currenthp <=0):
            self.canvas.delete("atk")
            
    def poserBuilding(self, b, x, y):
        if (not self.isVueUnivers):
            if (b == "Caserne"):
                self.canvas.create_image(x, y, image =self.imageUsine, tags=("Caserne",b.idJoueur,b.idBatiment))
                
            elif(b == "Mine"):
                self.canvas.create_image(x, y, image =self.imageMine, tags=("Mine",b.idJoueur,b.idBatiment))
                
            self.modeConst=False
            self.nomBati = ""
            
            
    def afficherBatiment(self, b):
        if (not self.isVueUnivers):
            x = b.posx
            y = b.posy 
            if (b.nom == "caserne"):
                self.canvas.create_image(x, y, image =self.imageUsine, tags=("Caserne",b.idJoueur,b.idBatiment))
                
            elif(b.nom == "mine"):
                self.canvas.create_image(x, y, image =self.imageMine, tags=("Mine",b.idJoueur,b.idBatiment))

            self.modeConst=False
            self.nomBati = ""

            
    def construireCaserne(self):
        self.nomBati = "caserne"
        self.modeConst=True
        
    def construireMine(self):
        self.nomBati = "mine"
        self.modeConst=True
    
# Action des bindings 
    
    def clicDroit(self,event):
        clic = self.canvas.gettags(CURRENT)
        posx=event.x+self.canvasXMin
        posy=event.y+self.canvasYMin
        self.controleur.clicDroit(clic,posx,posy)
            
    def flecheHaut(self,event):
            if(self.canvasYMin > 15 ):
                self.canvasYMin -= 15
                self.canvas.yview_scroll(-15, "unit" )

        
    def flecheBas(self,event):
            if((self.canvasYMin+self.hauteur)+15 <= self.canvasYMax):
                self.canvasYMin+=15
                self.canvas.yview_scroll(15, "unit" )

        
    def flecheDroite(self,event):
            if((self.canvasXMin+self.largeur)+15 <= self.canvasXMax):
                self.canvasXMin+=15
                self.canvas.xview_scroll(15, "unit" )
                    
    def flecheGauche(self,event):
            if(self.canvasXMin > 15):
                self.canvasXMin-=15
                self.canvas.xview_scroll(-15, "unit" )

    def clicGauche(self,event):
        self.debutSelection=[event.x, event.y]
        """Cherche s'il y a un objet de clique"""
        clic = self.canvas.gettags(CURRENT)
        posx=event.x+self.canvasXMin
        posy=event.y+self.canvasYMin
        
        if clic:
            if clic[0]=="BlocRessource" and self.modeConst and self.nomBati=="mine":
                action = ["creerBatiment", self.controleur.jeu.monId, "mine", posx, posy]
                self.controleur.envoyerAction(action)
            else:
                self.controleur.clicGauche(clic)
  
        else:
            if self.isVueUnivers:
                self.afficherInfoDef()
            else:
                if self.modeConst and self.nomBati!="mine":
                    action = ["creerBatiment", self.controleur.jeu.monId, "caserne", posx, posy]
                    self.controleur.envoyerAction(action)

                else:
                    self.afficherVuePlaneteDef()
                
            
            
    def afficherInfoVaisseau(self, v):
        liste = self.controleur.getListeVaisseaux()
        
        nbUnit=0
        for i in v.listeUnites:
            nbUnit=nbUnit+1
            
        self.label4.config(text="Nb D'Unites: ")
        self.label5.config(text="Proprietaire: ")
        self.labelType.config(text="Vaisseau")
        self.labelNom.config(text=v.nom)
        self.labelX.config(text=str('%.2f'%v.posx))
        self.labelY.config(text=str('%.2f'%v.posy))
        self.labelZ.config(text=str('%.2f'%v.posz))
        self.labelSys.config(text=str(nbUnit))
        self.labelPro.config(text="Joueur"+str(v.iDjoueur))
        
        self.setBoutonDef()
        self.bouton1.config(text="-->",state=DISABLED)
        self.bouton2.config(text="Stop",state=DISABLED)
        self.bouton3.config(text="Att",state=DISABLED)
        if v.nom == "mothership":
            self.bouton4.config(text="NewV",command=self.creerNouveauVaisseau, state=NORMAL)
        
    def afficherInfoUnite(self, u):
        self.label4.config(text="")
        self.label5.config(text="Proprietaire: ")
        
        self.labelType.config(text="Unite")
        self.labelNom.config(text=u.nom)
        self.labelX.config(text=str('%.2f'%u.posx))
        self.labelY.config(text=str('%.2f'%u.posy))
        self.labelZ.config(text=" ")
        self.labelSys.config(text=" ")
        self.labelPro.config(text="Joueur"+str(u.iDjoueur))
        
        self.setBoutonDef()
        self.bouton1.config(text="-->",state=DISABLED)
        self.bouton2.config(text="Stop",state=DISABLED)
        self.bouton3.config(text="Deco",command=self.changeVue, state=NORMAL)
        self.bouton5.config(text="Casn",command=self.construireCaserne, state=NORMAL)
        self.bouton6.config(text="mine",command=self.construireMine, state=NORMAL)
        
       
    def afficherInfoPlanete(self,planete):
        self.label4.config(text="Systeme Solaire: ")
        self.label5.config(text="Proprietaire: ")
        
        self.labelType.config(text="Planete")
        self.labelNom.config(text=planete.nom)
        self.labelX.config(text=str('%.2f'%planete.posX))
        self.labelY.config(text=str('%.2f'%planete.posY))
        self.labelZ.config(text=str('%.2f'%planete.posZ))
        self.labelSys.config(text="Etoile "+str(planete.sysSolaire))
        self.labelPro.config(text=planete.joueur)
        
        self.setBoutonDef()
        self.bouton1.config(text="Appr",state=DISABLED)
        self.bouton2.config(text="Land", state=DISABLED)
        self.bouton3.config(text="Colo",state=DISABLED)
        
        if(self.controleur.vaisseauProche()):
            self.bouton2.config(state=NORMAL,command=self.changeVue)
            self.bouton3.config(state=NORMAL,command=self.controleur.coloniser)
   
    def afficherInfoEtoile(self, etoile):
        self.label4.config(text="")
        self.label5.config(text="")
        
        self.labelType.config(text="Etoile")
        self.labelNom.config(text="Etoile "+str(etoile.idEtoile))
        self.labelX.config(text=str('%.2f'%etoile.x))
        self.labelY.config(text=str('%.2f'%etoile.y))
        self.labelZ.config(text=str('%.2f'%etoile.z))
        self.labelSys.config(text="")
        self.labelPro.config(text="")
        
        self.setBoutonDef()
        
    def afficherInfoBatiment(self, id):
        for j in self.controleur.jeu.listeJoueurs:
            for k in j.batiment:
                if (k.idBatiment == id):
                    b = k
                        
        self.label4.config(text="")
        self.label5.config(text="Proprietaire: ")
        
        self.labelType.config(text="Batiment")
        self.labelNom.config(text=b.nom)
        self.labelX.config(text=b.posx)
        self.labelY.config(text=b.posy)
        self.labelZ.config(text="")
        self.labelSys.config(text="")
        self.labelPro.config(text="Joueur"+str(b.idJoueur))
        
        self.setBoutonDef()
        
    def afficherInfoDef(self):
        
        self.label4.config(text="")
        self.label5.config(text="")
        
        self.labelType.config(text="Inconnu")
        self.labelNom.config(text="Sans nom")
        self.labelX.config(text=" ")
        self.labelY.config(text=" ")
        self.labelZ.config(text=" ")
        self.labelSys.config(text=" ")
        self.labelPro.config(text=" ")
        
        self.setBoutonDef()
        
    def setBoutonDef(self):
        self.bouton1.config(text="",state=DISABLED)
        self.bouton2.config(text="", state=DISABLED)
        self.bouton3.config(text="", state=DISABLED)
        self.bouton4.config(text="",state=DISABLED)
        self.bouton5.config(text="", state=DISABLED)
        self.bouton6.config(text="", state=DISABLED)
        self.bouton7.config(text="",state=DISABLED)
        self.bouton8.config(text="", state=DISABLED)
        self.bouton9.config(text="", state=DISABLED)
        self.bouton10.config(text="",state=DISABLED)
        self.bouton11.config(text="", state=DISABLED)
        self.bouton12.config(text="", state=DISABLED)
        self.bouton13.config(text="",state=DISABLED)
        self.bouton14.config(text="", state=DISABLED)
        self.bouton15.config(text="", state=DISABLED)
        self.bouton16.config(text="", state=DISABLED)
        
    def setInfo (self):
        if self.controleur.getTypeVue():
            self.labelT.config(text="TYPE: ")
            self.labelN.config(text="NOM: ")
            self.label1.config(text="Coordonee X: ")
            self.label2.config(text="Coordonee Y: ")
            self.label3.config(text="Coordonee Z: ")
            self.label4.config(text=" ")
            self.label5.config(text="Proprietaire: ")
        else:
            self.labelT.config(text="TYPE: ")
            self.labelN.config(text="NOM: ")
            self.label1.config(text="Coordonee X: ")
            self.label2.config(text="Coordonee Y: ")
            self.label3.config(text="Quantite: ")
            self.label4.config(text=" ")
            self.label5.config(text="Proprietaire: ")
        
    def resetInfo(self):
        self.labelType.config(text="")
        self.labelNom.config(text="")
        self.labelX.config(text="")
        self.labelY.config(text="")
        self.labelZ.config(text="")
        self.labelSys.config(text="")
        self.labelPro.config(text="")
        
    def changeVue(self):
        self.resetInfo()
        self.setBoutonDef()
        self.setInfo()
        self.controleur.changeVue()
        
        if(not self.controleur.getTypeVue()):
            if(self.controleur.vaisseauProche()):
                self.afficherVuePlanete()
                self.controleur.afficherVuePlanete()
        else:
            self.afficherUnivers()
            
    def creerNouveauVaisseau(self):
        action = ["creerVaisseau", self.controleur.jeu.monId, "combat", self.controleur.jeu.listeJoueurs[self.controleur.jeu.monId].vaisseauxCourant[0].posx, self.controleur.jeu.listeJoueurs[self.controleur.jeu.monId].vaisseauxCourant[0].posy]
        self.controleur.envoyerAction(action)
        
    def afficherMinerais(self):
        self.labelQteMine = Label(self.frameJoueur, text=str(self.controleur.getMinerais()), width=15)
        self.labelQteMine.grid(row=1, column=2)
     